package com.toncen.samepms.fisher.filter;

import java.util.ArrayList;
import java.util.List;

import com.toncen.samepms.fisher.condition.ChannelEqulasCondition;
import com.toncen.samepms.fisher.condition.ChannelLikeCondition;
import com.toncen.samepms.fisher.condition.ChannelNotEqulasCondition;
import com.toncen.samepms.fisher.condition.ChannelNotLikeCondition;
import com.toncen.samepms.fisher.condition.RoleLikeCondtion;
import com.toncen.samepms.system.dao.RoleDao;
import com.toncen.samepms.system.domain.Role;
import com.sky.fisher.condition.AbstractCondition;
import com.sky.fisher.filter.AbstractColumnFilter;
import com.sky.fisher.filter.Options;
import com.sky.fisher.model.CommonColumnModel;

public class ChannelColumnFilter extends AbstractColumnFilter {

	private AbstractCondition[] conditons = new AbstractCondition[] { new ChannelEqulasCondition() , new ChannelNotEqulasCondition(),
			new ChannelLikeCondition(), new ChannelNotLikeCondition()};

	/**
	 * 
	 */
	public ChannelColumnFilter() {
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.filter.AbstractColumnFilter#getConditons()
	 */
	@Override
	protected AbstractCondition[] getConditons() {
		return conditons;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.filter.AbstractColumnFilter#getValueOptions(com.sky.fisher.model.CommonColumnModel)
	 */
	public List<Options> getValueOptions(CommonColumnModel column) throws Exception {
		List<Options> valueOptions = new ArrayList<Options>();
		RoleDao roleDao = new RoleDao();
		List<Role> roles = roleDao.getAllByState(1);
		for (Role role : roles) {
			valueOptions.add(new Options(role.getName(), role.getName()));
		}
		return valueOptions;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.sky.fisher.filter.AbstractColumnFilter#getDefaultCondition()
	 */
	@Override
	public AbstractCondition getDefaultCondition() {
		return new RoleLikeCondtion();
	}

	@Override
	public String getValidateMessage() {
		return null;
	}

	@Override
	public String getValidatePattern() {
		return null;
	}
}
